<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page import="com.sinodata.bsm.common.vo.FaultTrapMsg"%>
<%@ include file="../include/taglib.jsp"%>
<%
    response.setHeader("Cache-Control", "no-store");
	response.setHeader("Pragrma", "no-cache");
	response.setDateHeader("Expires", 0);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>TRAP列表页面</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<%@ include file="../include/common.jsp"%>
<%@ include file="../include/table.jsp"%>

<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/style/default/bsm/sub_menu.css" />

<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/style/default/bsm/fault/trap.css" />
	
<script type="text/javascript" src="${pageContext.request.contextPath}/js/calendar/zh_CN_WdatePicker.js"></script>

<script type=text/javascript>
	function search(){
		var oTable=$("#trapList").dataTable();
		oTable.fnPageChange("first",true);
	}
	
	function add_zero(temp)
	{
		 if(temp<10) 
		 		return "0"+temp;
		 else 
		 		return temp;
	}
	
	function initDate(){
		var currentDate =new Date();
		//赋默认值
		$('#beginDate').val(currentDate.getFullYear()+"-"+add_zero(currentDate.getMonth()+1)+"-"+add_zero(currentDate.getDate())+" 00:00");
 		$('#endDate').val(currentDate.getFullYear()+"-"+add_zero(currentDate.getMonth()+1)+"-"+add_zero(currentDate.getDate())+" "+add_zero(currentDate.getHours())+":59");
	}
	
	
	$(function() {
		initDate();
		//加载grid
		var oTable=	$('#trapList').dataTable({
			"bProcessing": true, 
			"bServerSide": true, 
			"sServerMethod": 'POST',
			"sAjaxSource":'${pageContext.request.contextPath}/fault/trap!list.action',
			"bPaginate": true,
			"bSort": true,
			"bFilter":false,
			"bJQueryUI":false,
			"sPaginationType": "full_numbers",
			"sDom":'rt<"bottom"flpi>',
			"iDisplayLength":20,
			"sScrollX" : '100%',
			"aLengthMenu": [[20, 50], [20, 50]],
			"aoColumns":[
				{"mDataProp":"ip"},
				{"mDataProp":"time"},
				{"mDataProp":"generic"},
				{"mDataProp":"errorstatus"},
				{"mDataProp":"comunity"},
				{"mDataProp":"version"},
				{"mDataProp":"msg"}
			], 
			 "oLanguage": { 
 				"sLengthMenu": "每页 _MENU_ 条",
 				"sZeroRecords": "  ",
				"sInfo": "当前从 _START_ 到 _END_ 条,共 _TOTAL_ 条记录", 
				"sInfoEmpty": "没有找到记录",
				"oPaginate":{"sFirst":"首页","sPrevious":"上一页","sNext":"下一页","sLast":"尾页"}	
			},
		    "fnServerParams":function(aoData){
		    	aoData.push({'name':'ip','value':$('#ip').val()});
				aoData.push({'name':'start','value':$('#beginDate').val()});
				aoData.push({'name':'end','value':$('#endDate').val()});
		    }
		});	
		
		$('#ip').bind('keyup', function(event){
			   if (event.keyCode=="13"){
				   search();
			   }
		});
	});
</script>

</head>
<body >
	<div class="searchFormStyle "  style="width:99%">
		 <span class="search-span">
  		    <label >源IP：</label>
  			<input type="text" id="ip"/>
    	 </span>
    	
   		<span class="search-span">
		   <label >时间范围：</label>
  		   <input id="beginDate" name="beginDate" class="Wdate" type="text" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',maxDate:'%y-%M-%d %H:%m',readOnly:true})"/>
		   <label>-</label>
		   <input id="endDate" name="endDate" class="Wdate" type="text" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',maxDate:'%y-%M-%d %H:%m',minDate:$('#beginDate').val(),readOnly:true})"/>
	    </span>
	    <span class="search-span">
	    	<input type="button" onclick="search();" value="查询" class="searchFormButtonStyle" />
	    </span>
	</div>
	
	<table id="trapList" width="99%"  cellpadding="0" cellspacing="0" border="0" class="display" >
		<thead>
			<tr>
				<th width="5%">源IP</th>
				<th width="8%">接收时间</th>
				<th width="5%">TRAP类别</th>
				<th width="5%">差错状态</th>
				<th width="5%">团体名</th>
				<th width="1%">版本</th>
				<th width="45%">消息</th>
			</tr>
		</thead>
	</table>
</body>
</html>